home *** CD-ROM | disk | FTP | other *** search
- { The good old 'Hello World' program made in HighSpeed Pascal }
- { This is a translation of the RKM example and does it the hard
- way of calling the operating system directly }
-
- Program HelloWorld;
-
- Uses Exec,Graphics,Intuition;
-
-
- type
- tFont= record
- font_name: pCString; {font_name}
- font_no: Integer; {TOPAZ_SIXTY}
- font_ddd1: ShortInt; {FS_NORMAL}
- font_ddd2: ShortInt; {FPF_ROMFONT}
- end;
-
-
- var
- MyNewWindow: tNewWindow;
- MyNewScreen: tNewScreen;
-
- FontName: CString;
- Title: CString;
- WTitle: CString;
- MyFont: tFont;
-
- MyScreen: pScreen;
- MyWindow: pWindow;
- L: Longint;
-
- begin
-
- GfxBase:=pGfxBase(OpenLibrary('graphics.library',0));
- IntuitionBase:=pIntuitionBase(OpenLibrary('intuition.library',0));
-
- with MyFont do begin
- PasToC('Topaz.font',FontName); font_name:=@FontName;
- font_no :=TOPAZ_SIXTY;
- font_ddd1:=FS_NORMAL;
- font_ddd2:=FPF_ROMFONT;
- end;
-
- with MyNewScreen do begin
- LeftEdge:=0;
- TopEdge:=0;
- Width:=320;
- Height:=200;
- Depth:=2;
- DetailPen:=0;
- BlockPen:=1;
- ViewModes:=0;
- Type_:=CUSTOMSCREEN;
- Font:=@MyFont;
- PasToC('HighSpeed Pascal Screen',Title);
- DefaultTitle:=@Title;
- Gadgets:=NIL;
- CustomBitMap:=NIL;
- end;
- MyScreen:=OpenScreen(@MyNewScreen);
- if MyScreen=NIL then Halt(1);
-
- with MyNewWindow do begin
- LeftEdge:=20;
- TopEdge:=20;
- Width:=300;
- Height:=100;
- DetailPen:=0;
- BlockPen:=1;
- PasToC('A Simple Window',WTitle); Title:=@WTitle;
- Flags:=WINDOWCLOSE or SMART_REFRESH or
- ACTIVATE or WINDOWSIZING or
- WINDOWDRAG or WINDOWDEPTH;
- IDCMPFlags:=CLOSEWINDOW_;
- Type_:=CUSTOMSCREEN;
- FirstGadget:=NIL;
- CheckMark:=NIL;
- Screen:=MyScreen;
- BitMap:=NIL;
- MinWidth:=100;
- MinHeight:=25;
- MaxWidth:=640;
- MaxHeight:=200;
- end;
- MyWindow:=OpenWindow(@MyNewWindow);
- if MyWindow=NIL then begin
- CloseScreen(MyScreen); {Remove the screen opened before}
- halt(2);
- end;
-
- with MyWindow^ do begin
- Move_(RPort,20,20);
- Text_(RPort,'Hello World',11);
- L:=Wait(BitMask(UserPort^.MP_SIGBIT));
- end;
-
- CloseWindow(MyWindow);
- CloseScreen(MyScreen);
- CloseLibrary(Pointer(IntuitionBase));
- CloseLibrary(Pointer(GfxBase));
- end.
-